<script>
  /**
   * vuex管理登陆状态，具体可以参考官方登陆模板示例
   */
  import { mapMutations } from 'vuex'
  import Vue from 'vue'
  export default {
    methods: { ...mapMutations(['login', 'changeperson', 'getadress']) },
    onLaunch: function() {
      let _this = this
      uni.getSystemInfo({
        success: function(e) {
          // #ifndef MP
          Vue.prototype.StatusBar = e.statusBarHeight
          if (e.platform == 'android') {
            Vue.prototype.CustomBar = e.statusBarHeight + 50
          } else {
            Vue.prototype.CustomBar = e.statusBarHeight + 45
          };
          // #endif

          // #ifdef MP-WEIXIN
          Vue.prototype.StatusBar = e.statusBarHeight
          let custom = wx.getMenuButtonBoundingClientRect()
          Vue.prototype.Custom = custom
          Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight
          // #endif		

          // #ifdef MP-ALIPAY
          Vue.prototype.StatusBar = e.statusBarHeight
          Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight
          // #endif					
          _this.$store.state.$screenHeight = e.windowHeight
        }
      })

    },
    onLoad(option) {},
    onShow: function() {
      let token = this.$ComFunJS.getStorage(this.$ComFunJS.adminToken)
      let localhost = this.$ComFunJS.getStorage('localhost')
      localhost.then((res) => {
        this.$ComFunJS.adminAdress = res;
      })
      token.then(res => {
        if (res) {
          this.$ComFunJS.token = res.token
          this.login(res)
        }
      })
    },
    onHide: function() {
      console.log('App Hide')
    },
  }
</script>

<style lang="scss">
  .u-popup__content {
    border-radius: 18rpx !important;
  }

  .container {
    font-family: 'Arial', sans-serif;
    /* 确保字体支持中文 */
  }

  @import "common/iconfont/iconfont.css";
  @import "common/main.css";
  @import "uni_modules/uview-ui/index.scss";
</style>